from datetime import datetime, timedelta

def get_today():
    today = datetime.today()
    return today.strftime('%Y-%m-%d')


def get_week(today):
    today = datetime.strptime(today, '%Y-%m-%d')  # 将字符串格式化为datetime类型
    weekday = today.weekday()  # 获取输入的日期是周几：int 周一为0
    # print(weekday)
    ret = list()
    # 这周开始的时间：这周开始的日期为今天的日期减去周几，如周一的减0，所以开始日期就是输入日期了
    start_day = today - timedelta(weekday)
    for i in range(5):
        wd = start_day + timedelta(i)  # 从开始日期加一整周的时间
        date_value = wd.strftime('%Y-%m-%d')
        date_name = wd.strftime('%m/%d')
        ret.append({'name': date_name, 'value': date_value})  # 转换为字符串后加入列表中
    return ret